//
//  JsPixelbufferManager.h
//  JsoUtilitySdk
//
//  Created by Gikki Ares on 2021/11/8.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface Js_PixelBufferManager : NSObject

+ (instancetype)sharedInstance;

+ (UIImage *)imageFromRgbaPixelBuffer:(CVPixelBufferRef)pixelBuffer;
+ (CGImageRef)cgimageFromRgbaPixelBuffer:(CVPixelBufferRef)pixelBuffer;


+ (void)displayImageInfo:(CGImageRef)cgimage;

	//- (CVPixelBufferRef)pixelBufferFromImage;
+ (CVPixelBufferRef)pixelBufferFromImage:(UIImage *)image;
+ (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)cgimage;

+ (CGImageRef)cgimageFormSampleBuffer:(CMSampleBufferRef)sb;

/**
 此PixelBuffer必须是RGBA格式的才能直接显示.
 */
+ (CGImageRef)cgimageFormPixelBuffer:(CVPixelBufferRef)pPixelBuffer;
+ (GLvoid*)rawImageDataOfCGImage:(CGImageRef)cgimage;

+ (void)checkCVPixelBuffeInfo:(CVPixelBufferRef)pixelBuffer;

@end

NS_ASSUME_NONNULL_END
